import React, { useRef, useState } from 'react'

export default function App() {
    const [name, setName] = useState<string>("张无忌")
    const txtRef = useRef<HTMLInputElement>(null)
    return (
        <div>
            App-{name}
            <div>
                <input type="text" ref={txtRef} />
                <button onClick={() => {
                    setName((txtRef.current as HTMLInputElement).value)
                }}>修改</button>
            </div>
        </div>
    )
}
